import Vue from "vue"
import VueRouter from "vue-router"
import HomeView from "../views/HomeView.vue"
import CatalogView from "../views/CatalogView.vue"
import IntegrationView from "../views/IntegrationView.vue"
import CartView from "../views/CartView.vue"
import UserView from "../views/UserView.vue"
import userMassage from '@/pages/UserMassage.vue'
import search from '@/pages/SearchPage.vue'
import collectionGoods from '@/pages/collectionGoods.vue'


Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    component: HomeView,
    //重定向到homeView
    redirect: "/home",
  },
  {
    path: "/home",
    name: "home",
    component: HomeView,
  },
  {
    path: "/catalog",
    name: "catalog",
    component: CatalogView,
  },
  {
    path: "/integration",
    name: "integration",
    component: IntegrationView,
    props: (route) => ({ type: Number(route.query.type) || 0 }) 
  },
  {
    path: "/cart",
    name: "cart",
    component: CartView,
  },
  {
    path: "/user",
    name: "user",
    component: UserView,
  },
  {
    path: '/search',
    component: search,
  },
  {
    path: '/user/massage',
    component: userMassage,
    meta: {
      fullPage: true
    }
  },
  {
    path: '/user/collectionGoods',
    component: collectionGoods,
    meta: {
      fullPage: true
    }
  },

];

const router = new VueRouter({
  mode: "hash",
  base: process.env.BASE_URL,
  routes,
});

export default router;
